//package com.config;
//
//import org.apache.ibatis.session.ExecutorType;
//import org.apache.ibatis.session.SqlSessionFactory;
//import org.mybatis.spring.SqlSessionFactoryBean;
//import org.mybatis.spring.SqlSessionTemplate;
//import org.springframework.beans.factory.annotation.Qualifier;
//import org.springframework.boot.context.properties.ConfigurationProperties;
//import org.springframework.boot.jdbc.DataSourceBuilder;
//import org.springframework.context.annotation.Bean;
//import org.springframework.context.annotation.Configuration;
//import org.springframework.jdbc.datasource.DataSourceTransactionManager;
//import org.springframework.transaction.annotation.EnableTransactionManagement;
//import tk.mybatis.spring.annotation.MapperScan;
//
//import javax.sql.DataSource;
//
///**
// * @author: create by God of SJF
// * @version: v1.0
// * @description: com.config
// * @date:2021/9/9
// */
//
//@Configuration
//@MapperScan(basePackages = "com.mapper.entity.mapper", sqlSessionTemplateRef = "rdsSqlSessionTemplate")
//@EnableTransactionManagement(proxyTargetClass = true)
//public class EntityDataSourceConfiguration {
//
//    @Bean
//    @Qualifier("rds")
//    @ConfigurationProperties(prefix = "spring.datasource.entity")
//    public DataSource rdsDataSource() {
//        return DataSourceBuilder.create().build();
//    }
//    @Bean
//    @Qualifier("rds")
//    public SqlSessionFactory rdsSqlSessionFactory(@Qualifier("rdsDataSource") DataSource dataSource) throws Exception {
//        SqlSessionFactoryBean bean = new SqlSessionFactoryBean();
//        bean.setDataSource(dataSource);
//        return bean.getObject();
//    }
//    @Bean
//    @Qualifier("rds")
//    public DataSourceTransactionManager rdsTransactionManager(@Qualifier("rdsDataSource") DataSource dataSource) {
//        return new DataSourceTransactionManager(dataSource);
//    }
//    @Bean
//    @Qualifier("rds")
//    public SqlSessionTemplate rdsSqlSessionTemplate(@Qualifier("rdsSqlSessionFactory") SqlSessionFactory sqlSessionFactory) throws Exception {
//        return new SqlSessionTemplate(sqlSessionFactory, ExecutorType.BATCH);
//    }
//}
